home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / hardware.762 < prev    next >
Text File  |  1992-02-06  |  4KB  |  78 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fswiss Helvetica;}
  2. \paperw11440
  3. \paperh9000
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ul0\fs28 SCSI quarter-inch cartridge tape drive variable block size I/O error\
  8. \
  9. Q:    I am trying to connect a quarter-inch SCSI tape drive to my system.  According to the messages on the console, the system recognizes it at bootup.  It seems to respond properly to the mt rewind command.  However, when I try to read from it or write to it, it fails with the following message:\
  10. \
  11.  
  12. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f1\fs24\fc0     tar: tape read error: I/O error
  13. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\fs28 \
  14. \
  15. The system console shows an error like the following:\
  16. \
  17.  
  18. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f1\fs24\fc0     st: cmd = 0x8 sr_io_status = 2H\
  19.         Sense key = 0x5  Sense Code = 0x0
  20. \f0\fs28 \
  21.  
  22. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520 \
  23. Can I use this drive or not?  What do I need to do?\
  24. \
  25. \
  26. A:    Quarter-inch cartridge tape drives typically transfer data in fixed-size blocks.  However, the default for the NeXT SCSI tape driver is variable block size.  If a fixed-block-size device receives a command that requests a transfer that is not a multiple of its block size, it will issue an error.  The sense key of "5" in the console error message above means that the device received an illegal request, in this case a request for a transfer of a size that it could not perform.\
  27. \
  28. For programs that allow it (e.g., dd), you can work around this by specifying transfers that are a multiple of the device's native block size.     \
  29. \
  30. For more general use, it is necessary to configure the driver for a fixed-block-size device with the MTIOCFIXBLK ioctl system call.    \
  31. \
  32. Below is a short program that will configure the driver for a device that supports transfers of 512-byte blocks.  Note that the block size and the device file name are hard-coded into it.  A slightly more intelligent program could read them from the command line.\
  33. \
  34. The program must run with root permissions.   The driver will remain configured across login sessions, until it is explicitly changed or the machine is rebooted.  You can configure the driver on bootup by running the program in rc.local.\
  35.  
  36. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\fc0 \
  37.  
  38. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520 To reconfigure the driver for variable-sized transfers, use the MTIOCVARBLK ioctl.\
  39. \
  40. See the st man page for more detail.\
  41. \
  42.  
  43. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f1\fs24\fc0     /*\
  44.     * The following code configures the SCSI tape driver for /dev/rst0 \
  45.     * to support fixed-sized data transfers of 512 bytes each.\
  46.     */\
  47.     \
  48.     #include <sys/types.h>\
  49.     #include <sys/file.h>\
  50.     #include <nextdev/scsireg.h>\
  51.     \
  52.     \
  53.     main()\
  54.     \{\
  55.         int    fd, error;\
  56.         int    blocksize = 512;\
  57.     \
  58.         fd = open("/dev/rst0", O_RDWR, 777);\
  59.         if (ioctl(fd, MTIOCFIXBLK, &blocksize))\
  60.         \{\
  61.             perror("ioctl failed\\n");\
  62.             return 1; \
  63.         \}\
  64.         close (fd);\
  65.         return 0;\
  66.     \}\
  67.  
  68. \f2     \
  69.  
  70. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\fs28 \
  71. \
  72. QA762\
  73.     \
  74. Valid for 1.0\
  75. Valid for 2.0\
  76. \
  77.  
  78.